/**
 * 
 */
package com.google.code.netz.wfe.events;

import static com.google.code.netz.wfe.events.PlaceEvent.PlaceEventType.TOKEN_ADDED;
import static com.google.code.netz.wfe.events.PlaceEvent.PlaceEventType.TOKEN_DELETED;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.google.code.netz.wfe.model.Place;

/**
 * @author <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
 * @since 1.0
 * @version $Id$
 */
public class PlaceEventListener implements ITypedEventListener<PlaceEvent<Place<?>>> {

	private static Log log = LogFactory.getLog(PlaceEventListener.class);

	/**
	 * {@inheritDoc}
	 * 
	 * @see com.google.code.netz.wfe.events.ITypedEventListener#onEvent(com.google.code.netz.wfe.events.TypedEvent)
	 */
	@Override
	public void onEvent(PlaceEvent event) {
		if (event.getType() == TOKEN_ADDED) {
			handleTokenAddedEvent(event);
		} else if (event.getType() == TOKEN_DELETED) {
			handleTokenDeletedEvent(event);
		}
	}

	/**
	 * 
	 * @param event
	 */
	private void handleTokenAddedEvent(PlaceEvent event) {
		log.info("Handling event: " + event.getType().asString());
	}

	/**
	 * 
	 * @param event
	 */
	private void handleTokenDeletedEvent(PlaceEvent event) {
		log.info("Handling event: " + event.getType().asString());
	}

}
